/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ru.vsu.cs.piit.hibernate;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;



/**
 *
 * @author Галчонок
 */
public abstract class HibernateSessionFactory {
    private static Configuration cfg = new AnnotationConfiguration().configure();
    private static SessionFactory sf = cfg.buildSessionFactory();
    static int i=0;

    private static Session session;

    public static Session getSession() {
        if (session == null) {
            session=sf.openSession();
        }
        return session;
    }
}
